#!/bin/bash

echo -e "\e[1;33m [root@localhost a]# uname -a      系统信息\e[0m"
uname -a
cat /etc/os-release|head -n 2
echo "--------------------------------"

echo -e "\e[1;33m[root@localhost a]# lscpu |egrep  ‘Socket|BIOS Model’             cpu信息\e[0m"
lscpu |egrep  "Socket|BIOS Model"
echo "--------------------------------"

echo -e "\e[1;33m[root@localhost a]# dmidecode -t 17    内存信息和数量\e[0m"
dmidecode -t 17|grep -Ei "type:|Manufacturer:|Speed:|Part Number:|Rank:"|sort -r|uniq
echo -n "内存数量："
dmidecode -t 17 |grep -i ddr |wc -l
dmidecode -t 17|grep -Ei "Serial Number:"|sort|uniq
echo "--------------------------------"

echo -e "\e[1;33m[root@localhost a]# nvme list      nvme信息 \e[0m"
nvme list
for i in `lsblk | grep disk|grep nvme |cut -d ' ' -f 1`
            do
                echo -ne "\e[1;33m $i \e[0m"
                smartctl -i /dev/$i |sed -n '4p;5p;6p;9p;10p'
                echo -ne "$i "
                smartctl -H /dev/$i | grep -i health
            done

echo "--------------------------------"

echo -e "\e[1;33m[root@localhost a]# lsblk | grep disk|grep sd |cut -d ' ' -f 1      sata硬盘信息\e[0m"
lsblk
for i in `lsblk | grep disk|grep sd |cut -d ' ' -f 1`
            do
		echo -ne "\e[1;33m $i \e[0m"    
	        smartctl -i /dev/$i |sed -n '4p;5p;6p;9p;10p'
                echo -ne "$i "
		smartctl -H /dev/$i | grep -i health 
            done
echo "--------------------------------"

echo -e "\e[1;33m[root@localhost a]# lspci |grep -Ei 'megaraid|lsi'   raid卡信息 \e[0m"
lspci |grep -Ei "megaraid|lsi" >/dev/null
net=$?
lspci |grep -Ei "megaraid|lsi"
if [ $net -eq 0 ];then
        for i in `lspci |grep -Ei "megaraid|lsi" |awk '{print $1}'`
        do
                echo -e "\033[34m **** $i **** \033[0m"
                lspci -vvs $i | egrep -w 'LnkSta' | GREP_COLORS='ms=1;33' grep --color=always 'LnkSta'
        done
fi
echo -e "\e[1;33m[root@localhost a]# storcli64 /call show|grep -i ’fw version‘   raid卡固件版本和raid阵列信息 \e[0m"
storcli64 /call show|grep -i "fw version"
storcli64 /call /vall show |grep -i raid
echo "--------------------------------"

echo -e "\e[1;33m[root@localhost a]# storcli64 /call show|grep -i HDD        HDD硬盘数\e[0m"
storcli64 /call show|grep -i HDD
echo "--------------------------------"

echo -e "\e[1;33m[root@localhost a]# lspci |grep -i net     		 网卡信息\e[0m"
lspci |grep -i net >/dev/null
net=$?
lspci |grep -i net
if [ $net -eq 0 ];then
        for i in `lspci |grep -i net |awk '{print $1}'`
        do
                echo -e "\033[34m **** $i **** \033[0m"
                lspci -vvs $i | egrep -w 'LnkSta' | GREP_COLORS='ms=1;33' grep --color=always 'LnkSta' 
                
        done
fi

echo -e "\e[1;33m[root@localhost a]# lspci |grep -i nvidia                  显卡/GPU信息\e[0m"
lspci |grep -i nvidia >/dev/null
net=$?
lspci |grep -i nvidia
if [ $net -eq 0 ];then
        for i in `lspci |grep -i nvidia |awk '{print $1}'`
        do
                echo -e "\033[34m **** $i **** \033[0m"
                lspci -vvs $i | egrep -w 'LnkSta' | GREP_COLORS='ms=1;33' grep --color=always 'LnkSta'

        done
fi
echo -e "\e[1;33m[root@localhost a]# dmidecode -t 39                  电源信息\e[0m"
dmidecode -t 39 


